<template>
    <div class="comment">
        <div class="comment-header">
            用户评价({{score}})
        </div>
        <div class="comment-cards">
            <div class="comment-card" :key="item.id" v-for="item in comments">
                <div class="comment-avatar">
                    <img width="40px" :src="item.headimgurl" alt="">
                </div>
                <div class="comment-bd">
                    <div class="comment-bd-tl clearfix">
                        <div class="fl">
                            {{item.nickname}}
                            <div class="comment-rate">
                                <div>
                                <yd-rate slot="left" :readonly="true"
                                color="#FFCD00"
                                active-color="#FFCD00" count="5" v-model="item.score"></yd-rate>
                                </div>
                                <div style="color: #FFCD00;">
                                {{item.score}}
                                </div>
                            </div>
                        </div>
                         <div class="fr">
                            {{item.create_time}}
                        </div>
                    </div>
                    <div class="comment-bd-info">
                        <span class="info-color fl">{{item.goodsNames}}</span>
                        <span class="price-color fr">￥ {{item.clearPrice}}</span>
                    </div>
                    <div class="comment-bd-desc">
                        {{item.contents}}
                    </div>
                    <div class="comment-bd-imgs">
                        <div class="comment-bd-imgs-slide clearfix">
                                <img v-for="(d, index ) in item.imgUrls" :key="index" width="80px" height="80px" :src="d" alt="">
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</template>

<script>
let axios = require("axios");
export default {
  data() {
    return {
      token: "",
      rate3: 4,
      comments: [],
      score: ''
    };
  },
  created() {
    let token = this.$route.params.token;
    let score = this.$route.params.score;
    this.token = token;
    this.score = score
    this.getList()
  },
  methods: {
    getList() {
      let self = this;
      let token = this.token;
      axios({
        method: "get",
        url: "/merchantcenter/estimatelist",
        params: {
          token: token
        }
      }).then(function(res) {
        let data = res.data.data;
        data.forEach(function (s) {
            if (s.imgUrls) {
                s.imgUrls = s.imgUrls[0].split(',')
            }
        })
        self.comments = data
      });
    }
  }
};
</script>

<style>
</style>
